﻿#ifndef CCamerSdkOper_H
#define CCamerSdkOper_H
/********************************************************************************
** @ Date:2025/04/29
** @ Author: HanJiaXin
** @ Description:摄像头操作类
** @ Version:1.0.0
** @ ClassName:CCamerSdkOper
** @ Fun:
********************************************************************************/

#include <QObject>
#include <QWidget>
#include "CDevDataCam.h"
#include "CVlcRtspOper.h"
#include "CVlcOper.h"

class CCamerSdkOper  : public QObject
{
	Q_OBJECT

private:
	static void CALLBACK ExceptionCallBack(DWORD dwType, LONG lUserID, LONG lHandle, void *pUser);

public:
	CCamerSdkOper(CDevDataCam* pDevDataCam);
	~CCamerSdkOper();

	bool initAndLogin(QString &sReInfo);                                      //初始化和连接
	bool initCamer(QString &sReInfo);                                         //初始化相机
	bool loginCamer(QString &sReInfo);                                        //用户注册设备
	bool login(QString &sReInfo);											  //外部登录命令
	bool realPlay(int nDevId, WId hHand, QWidget *pWidget, QString &sReInfo); //启动预览 有句柄 
	bool stopRealPlay(WId hHand, QString &sReInfo);                           //停止预览 有句柄 
	bool capture(int nDevId, QString &sPath, QString &sReInfo);               //拍照
	bool getImage(QString &sPath, QString &sReInfo);						  //获取视频帧
	bool ptzControlOther(int nCmd, int nSpeed, bool bRun, QString &sReInfo);  //控制云台
	bool ptzPresetOther(int nPresetIndex, int nCmd, QString &sReInfo);        //设置预置点和转到预置点

private:
	void getDevCfg();                                      //获取设备的通道资源
	void getDecoderCfg();                                  //获取云台解码器信息
	bool setExceptionCallback();
	bool captureIr(QString &sPath, QString &sReInfo);                        //红外拍照
	bool captureImg(QString &sPath, QString &sReInfo);                       //图像拍照
	bool captureImgEx(QString &sPath, QString &sReInfo);                     //获取抓拍图并处理划线
	QString getErrMsg();//获取错误描述

public:
	CDevDataCam *m_pDevDataCam;

private:
	QMap<WId, CVlcOper*>m_cMapVlc;   //Rtsp视频对象
	QMap<WId, bool>m_cMapVlcState;   //Rtsp视频对象状态
	QMap<int, QString> m_mapCmdName;//命令名称
};
#endif // ifndef CCamerSdkOper_H